<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/*
<span class='line'>  2</span>  * Toolbar.js
<span class='line'>  3</span>  * 
<span class='line'>  4</span>  * Copyright (c) 2011, OSBI Ltd. All rights reserved.
<span class='line'>  5</span>  *
<span class='line'>  6</span>  * This library is free software; you can redistribute it and/or
<span class='line'>  7</span>  * modify it under the terms of the GNU Lesser General Public
<span class='line'>  8</span>  * License as published by the Free Software Foundation; either
<span class='line'>  9</span>  * version 2.1 of the License, or (at your option) any later version.
<span class='line'> 10</span>  *
<span class='line'> 11</span>  * This library is distributed in the hope that it will be useful,
<span class='line'> 12</span>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
<span class='line'> 13</span>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
<span class='line'> 14</span>  * Lesser General Public License for more details.
<span class='line'> 15</span>  *
<span class='line'> 16</span>  * You should have received a copy of the GNU Lesser General Public
<span class='line'> 17</span>  * License along with this library; if not, write to the Free Software
<span class='line'> 18</span>  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
<span class='line'> 19</span>  * MA 02110-1301  USA
<span class='line'> 20</span>  */</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="COMM">/**
<span class='line'> 22</span>  * The global toolbar
<span class='line'> 23</span>  */</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">Toolbar</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Backbone.View.extend</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">    </span><span class="NAME">tagName</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"div"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">    
<span class='line'> 27</span>     </span><span class="NAME">events</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">        </span><span class="STRN">'click #new_query'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'new_query'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">        </span><span class="STRN">'click #open_query'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'open_query'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">        </span><span class="STRN">'click #logout'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'logout'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">        </span><span class="STRN">'click #about'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'about'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="WHIT">        </span><span class="STRN">'click #issue_tracker'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'issue_tracker'</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">    
<span class='line'> 35</span>     </span><span class="NAME">template</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_.template</span><span class="PUNC">(</span><span class="STRN">"&lt;ul>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='line'> 37</span>                     </span><span class="STRN">"&lt;li>&lt;a id='new_query' href='#new_query' title='New query' class='new_tab i18n sprite'>&lt;/a>&lt;/li>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">                    </span><span class="STRN">"&lt;li class='separator'>&nbsp;&lt;/li>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">                    </span><span class="STRN">"&lt;li>&lt;a id='open_query' href='#open_query' title='Open query' class='open_query i18n sprite'>&lt;/a>&lt;/li>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> 
<span class='line'> 40</span>                     </span><span class="STRN">"&lt;li class='separator'>&nbsp;&lt;/li>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT">                    </span><span class="STRN">"&lt;li>&lt;a id='logout' href='#logout' title='Logout' class='logout i18n sprite'>&lt;/a>&lt;/li>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">                    </span><span class="STRN">"&lt;li>&lt;a id='about' href='#about' title='About' class='about i18n sprite'>&lt;/a>&lt;/li>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">                    </span><span class="STRN">"&lt;li class='separator'>&nbsp;&lt;/li>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">                    </span><span class="STRN">"&lt;li>&lt;a id='issue_tracker' href='#issue_tracker' title='Issue Tracker' class='bug i18n sprite'>&lt;/a>&lt;/li>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">                </span><span class="STRN">"&lt;/ul>"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">                </span><span class="STRN">"&lt;h1 id='logo'>&lt;a href='http://www.analytical-labs.com/' title='Saiku - Next Generation Open Source Analytics' class='sprite'>Saiku&lt;/a>&lt;/h1>"</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">            </span><span class="PUNC">)</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">    
<span class='line'> 50</span>     </span><span class="NAME">initialize</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">        </span><span class="NAME">this.render</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">    
<span class='line'> 54</span>     </span><span class="NAME">render</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">this.el</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'id'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'toolbar'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">            </span><span class="PUNC">.</span><span class="NAME">html</span><span class="PUNC">(</span><span class="NAME">this.template</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">        
<span class='line'> 58</span>         </span><span class="COMM">// Trigger render event on toolbar so plugins can register buttons</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">        </span><span class="NAME">Saiku.events.trigger</span><span class="PUNC">(</span><span class="STRN">'toolbar:render'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">toolbar</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">        
<span class='line'> 61</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">    
<span class='line'> 64</span>     </span><span class="COMM">/**
<span class='line'> 65</span>      * Add a new tab to the interface
<span class='line'> 66</span>      */</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">    </span><span class="NAME">new_query</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">        </span><span class="NAME">Saiku.tabs.add</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Workspace</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">    
<span class='line'> 72</span>     </span><span class="COMM">/**
<span class='line'> 73</span>      * Open a query from the repository into a new tab
<span class='line'> 74</span>      */</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">    </span><span class="NAME">open_query</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">dialog</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_.detect</span><span class="PUNC">(</span><span class="NAME">Saiku.tabs._tabs</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">tab</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">tab.content</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">OpenQuery</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">        
<span class='line'> 80</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">dialog</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">            </span><span class="NAME">dialog.select</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">            </span><span class="NAME">Saiku.tabs.add</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">OpenQuery</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">        
<span class='line'> 86</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">    
<span class='line'> 89</span>     </span><span class="COMM">/**
<span class='line'> 90</span>      * Clear the current session and show the login window
<span class='line'> 91</span>      */</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">    </span><span class="NAME">logout</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">        </span><span class="NAME">Saiku.session.logout</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">    
<span class='line'> 96</span>     </span><span class="COMM">/**
<span class='line'> 97</span>      * Show the credits dialog
<span class='line'> 98</span>      */</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">    </span><span class="NAME">about</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">        </span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">AboutModal</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">render</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">open</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">    
<span class='line'>104</span>     </span><span class="COMM">/**
<span class='line'>105</span>      * Go to the issue tracker
<span class='line'>106</span>      */</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">    </span><span class="NAME">issue_tracker</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">        </span><span class="NAME">window.open</span><span class="PUNC">(</span><span class="STRN">'https://github.com/OSBI/saiku/issues/new'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>111</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>112</span> </span></pre></body></html>